home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
BasePaneEditor.h
< prev
next >
Wrap
Text File
|
1997-07-28
|
4KB
|
156 lines
/*
* File: BasePaneEditor.h
* Summary: Abstract base class for view's that edit pane objects.
* Written by: Jesse Jones
*
* Copyright ゥ 1996 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <-> 10/15/96 JDJ Created
*/
#pragma once
#include <ZUndoableCommand.h>
#include <ZView.h>
//-----------------------------------
// Forward References
//
class TMultipleUndoableCommand;
// ===================================================================================
// class CBaseEditPaneCommand
// ===================================================================================
template <class PANE, class PANEINFO>
class CBaseEditPaneCommand : public TUndoableCommand {
typedef TUndoableCommand Inherited;
//-----------------------------------
// Initialization/Destruction
//
public:
virtual ~CBaseEditPaneCommand();
CBaseEditPaneCommand(PANE* pane, const PANEINFO& oldInfo, const PANEINFO& newInfo);
//-----------------------------------
// New API
//
public:
virtual void UpdatePane(const PANEINFO& info) = 0;
//-----------------------------------
// Inherited API
//
public:
virtual string GetText() const;
virtual bool IsValid() const;
protected:
virtual void OnDo();
virtual void OnUndo();
virtual void OnRedo();
//-----------------------------------
// Member data
//
protected:
TSafePtr<PANE> mPane;
PANEINFO mOldInfo;
PANEINFO mNewInfo;
};
// ===================================================================================
// CRootPaneEditor
// ===================================================================================
class CRootPaneEditor : public TView {
typedef TView Inherited;
//-----------------------------------
// Initialization/Destruction
//
public:
virtual ~CRootPaneEditor();
CRootPaneEditor(TView* superView);
//-----------------------------------
// New API
//
public:
virtual void SetPane(TPane* pane) = 0;
virtual bool Validate();
// Return false if the data in the editor isn't good to go.
virtual void Apply() = 0;
// Updates the pane with any changes the user has made.
virtual void Commit(TMultipleUndoableCommand* command) = 0;
// Finalizes any changes the user may have made.
virtual void Revert() = 0;
// Reverts the pane to it's original state.
};
// ===================================================================================
// CBasePaneEditor
// ===================================================================================
template <class PANE, class PANEINFO, class EDITCOMMAND>
class CBasePaneEditor : public CRootPaneEditor {
typedef CRootPaneEditor Inherited;
//-----------------------------------
// Initialization/Destruction
//
public:
virtual ~CBasePaneEditor();
CBasePaneEditor(TView* superView);
//-----------------------------------
// Inherited API
//
public:
virtual void SetPane(TPane* pane);
virtual void Apply();
virtual void Commit(TMultipleUndoableCommand* command);
virtual void Revert();
//-----------------------------------
// Internal API
//
protected:
virtual PANEINFO GetEditorInfo() const = 0;
virtual void SetEditorInfo(const PANEINFO& info) = 0;
void SetPaneInfo(const PANEINFO& info);
//-----------------------------------
// Member data
//
protected:
PANE* mPane;
PANEINFO mOldInfo;
};
#include "BasePaneEditor.inc"